package com.chijun.mf;

import com.alibaba.fastjson.JSON;
import com.chijun.mform.full.mode.ModeFormFullApprovePerson;
import com.example.ccj.u.server.Result;
import com.example.ccj.u.server.ServiceImpl;

import io.reactivex.Observable;
import retrofit2.http.Field;

public class CreateFormServiceImpl extends ServiceImpl {
    private volatile static CreateFormServiceImpl instance;

    public static CreateFormServiceImpl getInstance() {
        if (instance == null) {
            synchronized (CreateFormServiceImpl.class) {
                if (instance == null) {
                    instance = new CreateFormServiceImpl();
                }
            }
        }
        return instance;
    }

    private CreateFormService getService() {
        return getRetrofit().create(CreateFormService.class);
    }

    public Observable<Result> getCreateFormData(){
        return turnOutResultSync(getService().getCreateFormData("2"));
    }

    public Observable<Result> getCreateProcessPerson(){
        return turnOutResultSync(getService().getCreateProcessPerson("2"));
    }

    public Observable<Result> saveCreateForm(String value){
        return turnOutResultSync(getService().saveCreateForm(value));
    }

    public Observable<Result> getFillInFormData(String value){
        return turnOutResultSync(getService().getFillInFormConfigData(value));
    }

    public Observable<Result> saveFormData(String value){
        return turnOutResultSync(getService().saveFormData(value));
    }

    public Observable<Result> getAllForm(String value){
        return turnOutResultSync(getService().getAllForm(value));
    }

    public Observable<Result> loadFullData(String value){
        return turnOutResultSync(getService().loadFullData(value));
    }

    public Observable<Result> formFullUpdateApprove(ModeFormFullApprovePerson value){
        return turnOutResultSync(getService().formFullUpdateApprove(JSON.toJSONString(value)));
    }

    public Observable<Result> formFullPingLun(ModeFormFullApprovePerson value){
        return turnOutResultSync(getService().formFullPingLun(JSON.toJSONString(value)));
    }
    public Observable<Result> formFullZhuanJiao(ModeFormFullApprovePerson value, String forPersonId){
        return turnOutResultSync(getService().formFullZhuanJiao(forPersonId,JSON.toJSONString(value)));
    }

    public Observable<Result> getServerFormDataReturns(long formId,int startIndex,int count){
        return turnOutResultSync(getService().getServerFormDataReturns(formId,startIndex,count));
    }

    public Observable<Result> getServerSearchesForFormDataReturns(long formId, String searchText){
        return turnOutResultSync(getService().getServerSearchesForFormDataReturns(formId,searchText));
    }




}
